package com.aeasycredit.credit.tuef.handler;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.aeasycredit.credit.tuef.constant.TuefSegment;
import com.aeasycredit.credit.tuef.constant.TuefSummarySegmentEnum;
import com.aeasycredit.credit.tuef.model.TuefSummary;
import com.aeasycredit.credit.tuef.service.TuefSummaryService;

@Component
public class TuefSummaryDataHandler implements TuefDataHandler<TuefSummary> {
    
    @Autowired
    private TuefSummaryService tuefSummaryService;

    @Override
    public TuefSummary getData(String tuefBasicId) {
        return tuefSummaryService.getByTuefBasicId(tuefBasicId);
    }

    @Override
    public Class<? extends TuefSegment> supportTuefSegment() {
        return TuefSummarySegmentEnum.SEGMENT_TAG.getClass();
    }
    
    @Override
    public TuefSegment[] supportSegmentFields() {
        return TuefSummarySegmentEnum.values();
    }
}
